package com.test5;

import java.io.FileWriter;

public class FileWriterTest {
    public static void main(String[] args) throws Exception {
        //创建FileWriter对象
        FileWriter fw = new FileWriter("C:\\Users\\LDH\\Desktop\\test2.txt");
        //写入
        for (int i = 0; i < 10; i++) {
            fw.write("java你好\r\n");
            fw.flush();
        }
        //关闭
        fw.close();
        System.out.println("执行完毕");
    }
}
